def check_db_integrity(d,tbl,cnn):
    '检查dataframe数据是否符合目标数据库结构'
    with cnn.cursor() as cursor:
        cursor.execute('select * from {}'.format(tbl))
        dsc={i[0]:{'type':i[1],'len':i[3],'null':i[6]} for i in cursor.description}
        _s=set(d.columns)-set(dsc.keys())
        ctl=True
        if _s:
            print('data_frame 比表{}多{}列,清理之后继续'.format(tbl,set(_s)))
            return False
        for c in d.columns:
            if dsc[c]['type'] is int:
                print(c,dsc[c])
                try:
                    d[c].astype(int)
                except ValueError:
                    print('表:{},列:{}列存在不能转换为int的数据,请检查!'.format(tbl,c))
                    ctl=False
                    continue
            elif dsc[c]['type'] is str:
                try:
                    d[c]=d[c].astype(str)
                except ValueError:
                    print('表:{},列{}存在不能转换为str的数据'.format(tbl,c))
                    ctl=False
                    continue
                _d=d[d[c].str.len()>dsc[c]['len']*2]
                if len(_d):
                    print('表{},列{}存在超出数据库str类型定义长度({})的数据!'.format(tbl,c,dsc[c]['len']))
                    ctl=False
                    continue
                del _d
            if not dsc[c]['null']:
                _d=d[d[c].isnull()]
                if len(_d):
                    print('表:{},列:{}存在null数据!'.format(tbl,c))
                    ctl=False
                    continue
        return True